package com.epoint.mobileoa.personalized.epointcompany.bizlogic;

import java.util.HashMap;
import java.util.Map;

import android.os.Message;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.db.DBHelp;
import com.epoint.mobileoa.tools.WebServiceUtilDAL;

/**
 * @author liyc
 * @time 2012-4-17 下午2:55:50
 * @annotation 
 */
public class AddNewWorkContentTask extends Task {

	public AddNewWorkContentTask(SuperView con, HashMap<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		Map<String, Object> param = getParam();
		/*Map<String,String> map = new HashMap<String, String>();
		map.put("worktype", param.get("worktype").toString());
		map.put("businesstype", param.get("businesstype").toString());
		map.put("projectname", param.get("projectname").toString());
		map.put("projectguid", param.get("projectguid")==null?"":param.get("projectguid").toString());
		map.put("missionname", param.get("missionname").toString());
		map.put("missionguid", param.get("missionguid")==null?"":param.get("missionguid").toString());
		map.put("ywtime", param.get("ywtime").toString());
		map.put("jbtime", param.get("jbtime").toString());
		map.put("completepercent", param.get("completepercent").toString());
		map.put("businesscontent", param.get("businesscontent").toString());
		map.put("userguid", getFP().getUserguid());
		map.put("displayname", getFP().getDisplayname());
		String seamurl = generateURL("Epoint_AddNewWorkContent");
		String bs = HttpHelp.post(seamurl, map, null);*/
		
		String url = getCon().getString(R.string.epointcompany_rizhi_url);
		String namespace = getCon().getString(R.string.epointcompany_rizhi_namespace);
		String method = "AddGongZuoRZDetail";
		
		WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
				method, namespace);
		
		String ContentType = DBHelp.getItemValue(getCon(), param.get("worktype").toString(), "日志明细工作类别");
		String GZDWorkType = DBHelp.getItemValue(getCon(), param.get("businesstype").toString(), "日志明细工作类别");
		
		webservice.addProperty("ContentType", ContentType);
		webservice.addProperty("GZDWorkType", GZDWorkType);
		webservice.addProperty("ProjectGuid", param.get("projectguid")==null?"":param.get("projectguid").toString());
		webservice.addProperty("XiangMuMC", param.get("projectname").toString());
		webservice.addProperty("MissionGuid", param.get("missionguid")==null?"":param.get("missionguid").toString());
		webservice.addProperty("MissionName", param.get("missionname").toString());
		webservice.addProperty("GongZuoSJ", param.get("ywtime").toString());
		webservice.addProperty("ExtraWorkSJ",param.get("jbtime").toString());
		
		String cpercent = param.get("completepercent").toString();
		cpercent = cpercent.substring(0,cpercent.length()-1);
		
		webservice.addProperty("CompletePercent", Long.valueOf(cpercent));
		webservice.addProperty("IsPrivateWork", param.get("isbm").toString());
		webservice.addProperty("GongZuoNR", param.get("businesscontent").toString());
		webservice.addProperty("UserGuid",getFP().getUserguid());
		webservice.addProperty("UserName",getFP().getDisplayname());
		webservice.addProperty("ParentRowGuid", param.get("rzguid").toString());
		webservice.addProperty("RZDate",param.get("rzdate").toString().substring(0, 10));
		String bs = webservice.start();
		setMessageToRefreshUI(mess, getCon(), bs);
	}

}
